-
Notifications
You must be signed in to change notification settings - Fork 23
Modified handling pvd files when the triangulation is not present on all processes. #174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #174 +/- ##
=======================================
Coverage 0.00% 0.00%
=======================================
Files 11 11
Lines 3249 3349 +100
=======================================
- Misses 3249 3349 +100 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Hi @JordiManyer, I just noticed that this has not yet been merged. Are you looking/working on any other "fixes" for this problem? Thanks! |
|
You need to pull from master. In any case, I am not convinced this is the best way of doing things. For instance: If we are now passing the triangulation as input, why are we also passing the parts? Can't we just add a new method that has the triangulation instead of the parts? Also: within the Visualization.createpvd(parts::AbstractArray,args...;kwargs...)both Why do we need to know the parts? I think we do not. Only two changes are necessary: First, we check for empty parts when we want to save the individual files, i.e we only save the ones which have something. Second, we need to allow some flexibility for the main processor in case processor 1 is empty. struct DistributedPvd{T<:AbstractArray}
pvds::T
main::Int
end
DistributedPvd(pvds) = DistributedPvd(pvds,1)
function Base.setindex!(pvd::DistributedPvd,pvtk::AbstractArray,time::Real)
map(pvtk) do pvtk
!isnothing(pvtk) && vtk_save(pvtk)
end
map(pvtk,pvd.pvds) do pvtk,pvd
if part == pvd.main
pvd[time] = pvtk
end
end
endand you can pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds support for creating PVD (ParaView Data) files when triangulations are not present on all processes in a distributed setting. The main issue being addressed (issue #171) likely involved failures when some processes had empty triangulations.
Changes:
- Added a
partsfield toDistributedPvdstruct to track which parts have data - Introduced new
createpvdmethods that accept aDistributedTriangulationparameter and filter empty parts - Modified existing
createpvd,savepvd, andsetindex!methods to replacemap_maincalls with explicitmap+if part == 1checks - Updated NEWS.md to document the fix
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
| src/Visualization.jl | Added parts field to DistributedPvd, new createpvd methods for DistributedTriangulation with empty part filtering, and updated existing methods to handle empty parts |
| NEWS.md | Documented the fix for creating pvd files with empty triangulations |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| function Visualization.createpvd(trian::DistributedTriangulation,parts::AbstractArray,args...;kwargs...) | ||
| nparts, new_parts = filter_empty_parts(parts,local_views(trian)) | ||
| pvds = map(new_parts) do part | ||
| if part == 1 | ||
| paraview_collection(args...;kwargs...) | ||
| end | ||
| end | ||
| DistributedPvd(pvds,new_parts) | ||
| end |
Copilot
AI
Jan 13, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new createpvd method for handling DistributedTriangulation with potentially empty parts lacks test coverage. Consider adding a test case that creates a pvd file using a half-empty triangulation (similar to the half_empty_trian function in VisualizationTests.jl) to ensure the new functionality works correctly when triangulations are not present on all processes.
|
|
||
| - Added support for Gridap v0.19, with distributed counterparts for the new feaures introduced. This includes support for polytopal meshes, polytopal methods and patch assembly. Since PR[#175](https://github.com/gridap/GridapDistributed.jl/pull/175). | ||
| - Added `MacroDiscreteModel`, which gives a global numbering and classification of the interfaces between processors. Since PR[#175](https://github.com/gridap/GridapDistributed.jl/pull/175). | ||
| - Added support to create pvd files when the triangulation is not there on all processes. To achive this, a new method for the createpvd function is added. |
Copilot
AI
Jan 13, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spelling error: "achive" should be "achieve".
| - Added support to create pvd files when the triangulation is not there on all processes. To achive this, a new method for the createpvd function is added. | |
| - Added support to create pvd files when the triangulation is not there on all processes. To achieve this, a new method for the createpvd function is added. |
| - Added support to create pvd files when the triangulation is not there on all processes. To achive this, a new method for the createpvd function is added. | ||
|
|
||
| ## [0.4.7] - 2025-03-04 | ||
| ## [0.4.7] 2025-03-04 |
Copilot
AI
Jan 13, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent date format. All other entries use the format "## [version] - YYYY-MM-DD" with a hyphen before the date, but this entry is missing the hyphen.
| ## [0.4.7] 2025-03-04 | |
| ## [0.4.7] - 2025-03-04 |
| ## [0.4.8] - 2025-06-11 | ||
|
|
||
| ### Added | ||
| ### Fixed |
Copilot
AI
Jan 13, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing whitespace after "Fixed" should be removed.
| ### Fixed | |
| ### Fixed |
| map(pvtk) do pvtk | ||
| if !isnothing(pvtk) | ||
| vtk_save(pvtk) | ||
| end |
Copilot
AI
Jan 13, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing whitespace after the closing brace should be removed.
| end | |
| end |
| map_main(pvd.pvds) do pvd | ||
| vtk_save(pvd) | ||
| map(pvd.pvds, pvd.parts) do pvd, part | ||
| if part == 1 |
Copilot
AI
Jan 13, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing whitespace after the part == 1 condition should be removed.
| if part == 1 | |
| if part == 1 |
| end | ||
| end | ||
| map(pvtk,pvd.pvds,pvd.parts) do pvtk,pvd,part | ||
| if part == 1 |
Copilot
AI
Jan 13, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When using the non-filtered createpvd method (lines 247-254) with potentially empty triangulations, part == 1 could correspond to a process with an empty triangulation, making pvtk equal to nothing. Assigning nothing to the paraview collection may cause an error. Consider adding an additional check: if part == 1 && !isnothing(pvtk) to ensure the pvtk is valid before adding it to the collection.
| if part == 1 | |
| if part == 1 && !isnothing(pvtk) |
As shown in issue #171